class UsertypesController < ApplicationController
  # GET /usertypes
  # GET /usertypes.xml
  def index
    @usertypes = Usertype.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @usertypes }
    end
  end

  # GET /usertypes/1
  # GET /usertypes/1.xml
  def show
    @usertype = Usertype.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @usertype }
    end
  end

  # GET /usertypes/new
  # GET /usertypes/new.xml
  def new
    @usertype = Usertype.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @usertype }
    end
  end

  # GET /usertypes/1/edit
  def edit
    @usertype = Usertype.find(params[:id])
  end

  # POST /usertypes
  # POST /usertypes.xml
  def create
    @usertype = Usertype.new(params[:usertype])

    respond_to do |format|
      if @usertype.save
        flash[:notice] = 'Usertype was successfully created.'
        format.html { redirect_to(@usertype) }
        format.xml  { render :xml => @usertype, :status => :created, :location => @usertype }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @usertype.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /usertypes/1
  # PUT /usertypes/1.xml
  def update
    @usertype = Usertype.find(params[:id])

    respond_to do |format|
      if @usertype.update_attributes(params[:usertype])
        flash[:notice] = 'Usertype was successfully updated.'
        format.html { redirect_to(@usertype) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @usertype.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /usertypes/1
  # DELETE /usertypes/1.xml
  def destroy
    @usertype = Usertype.find(params[:id])
    @usertype.destroy

    respond_to do |format|
      format.html { redirect_to(usertypes_url) }
      format.xml  { head :ok }
    end
  end
end
